Skip to content

feat(tri-api): Direct Anthropic API agent — no claude CLI dependency (Issue #60)#61

Merged
gHashTag merged 1 commit intomainfrom
ralph/w1/tri-api-phase2
Mar 9, 2026
Merged

feat(tri-api): Direct Anthropic API agent — no claude CLI dependency (Issue #60)#61
gHashTag merged 1 commit intomainfrom
ralph/w1/tri-api-phase2

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

@gHashTag gHashTag commented Mar 9, 2026

Summary

  • Self-contained src/tri-api/ directory (624 LOC, 3 files, zero cross-directory imports)
  • tool_executor.zig: 4 tools (read_file, write_file, bash, grep) via std.fs + std.process.Child
  • tool_protocol.zig: Anthropic Messages API JSON build/parse (tool_use/tool_result protocol)
  • main.zig: Agentic loop — POST to api.anthropic.com/v1/messages, execute tools, feed results back
  • build.zig: +18 LOC — new tri-api executable target

First Trinity binary that talks to Claude API directly from Zig, no TypeScript/CLI wrapper.

Usage

ANTHROPIC_API_KEY=sk-... zig build tri-api -- "Read build.zig and count executables"
ANTHROPIC_API_KEY=sk-... zig build tri-api -- --model claude-sonnet-4-20250514 "Summarize the project"

Architecture

main.zig (entry + agentic loop, max 20 turns)
  ├── tool_protocol.zig (JSON build/parse for Anthropic tool_use)
  ├── tool_executor.zig (execute Read/Write/Bash/Grep via std)
  └── std.http.Client (direct HTTPS to api.anthropic.com)

Test plan

  • zig build compiles all targets including tri-api
  • zig fmt src/tri-api/ — no formatting issues
  • Binary runs: shows usage without args, API key error without env var
  • CI build passes
  • End-to-end: tri-api "Read build.zig" with real API key

Closes #60

🤖 Generated with Claude Code

…(Issue #60)

Self-contained agentic loop in src/tri-api/ (624 LOC, 3 files):
- tool_executor.zig: 4 tools (read_file, write_file, bash, grep) via std
- tool_protocol.zig: Anthropic Messages API JSON build/parse
- main.zig: POST to api.anthropic.com/v1/messages, tool_use loop

Zero cross-directory imports. Talks to Claude API directly from Zig.

Closes #60

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gHashTag gHashTag merged commit b787ece into main Mar 9, 2026
7 of 9 checks passed
gHashTag added a commit that referenced this pull request Mar 18, 2026
…warm v1.0 [Golden Chain #61]

- QuarkType enum(u6) → enum(u7): 128 capacity, 72/128 used
- +8 QuarkType variants (64-71): swarm_orchestrate, swarm_consensus,
  swarm_replication, swarm_failover, swarm_discovery_v2, swarm_self_heal,
  swarm_telemetry, swarm_anchor
- +4 ChainMessageTypes: SwarmOrchestrate, SwarmFailover, SwarmTelemetry,
  SwarmReplication
- +4 types: SwarmOrchState, SwarmFailoverConfig, SwarmTelemetryState,
  SwarmReplicationRecord
- +5 methods: orchestrateSwarm, swarmFailover, sendTelemetry,
  replicateState, swarmVerify
- Phase L verification: swarm orchestration + replication + telemetry
- Export v9 (54-byte header, backwards compatible v1-v9)
- Quarks 96→104 (13+13+13+14+13+12+13+13)
- WASM stub + Canvas fully synced
- 3054/3060 tests pass (2 pre-existing storage failures)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Mar 18, 2026
…(Issue #60) (#61)

Self-contained agentic loop in src/tri-api/ (624 LOC, 3 files):
- tool_executor.zig: 4 tools (read_file, write_file, bash, grep) via std
- tool_protocol.zig: Anthropic Messages API JSON build/parse
- main.zig: POST to api.anthropic.com/v1/messages, tool_use loop

Zero cross-directory imports. Talks to Claude API directly from Zig.

Closes #60

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Antigravity Agent <antigravity@vibee.org>
Co-authored-by: Claude <noreply@anthropic.com>
@gHashTag gHashTag deleted the ralph/w1/tri-api-phase2 branch April 3, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tri-cli Phase 2: Direct Anthropic API (kill claude CLI dependency)

1 participant